# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-movie
epoch=1
pkgver=5.10.14
pkgrel=1
pkgdesc='Movie player based on mpv'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-movie-reborn"
license=('GPL3')
depends=('deepin-qt5integration'  'ffmpegthumbnailer' 'libxtst' 'mpv' 'qt5-multimedia'
         'qtdbusextended' 'qtmpris')
makedepends=('cmake' 'gtest' 'ninja' 'qt5-tools')
groups=('deepin-extra')
options=('!lto')
source=("https://github.com/linuxdeepin/deepin-movie-reborn/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('f3ec17b25b91751931d2aaf101f412cfc36ee39e7b6bf62db89447056c76525bdb3cbb2f4b16a1d359e01c64b56088c4a23ae75c7a4b33caab043632feb93417')

prepare() {
  cd deepin-movie-reborn-$pkgver
  sed -i '/avformat.h>/i #include <libavcodec/avcodec.h>' src/libdmr/playlist_model.cpp
}

build() {
  cd deepin-movie-reborn-$pkgver
  export CXXFLAGS+=' -fpermissive'
  cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DVERSION=$pkgver .
  ninja
}

package() {
  cd deepin-movie-reborn-$pkgver
  DESTDIR="$pkgdir" ninja install
}
